home *** CD-ROM | disk | FTP | other *** search
- #!/bin/sh -e
-
- test -f /usr/share/debconf/confmodule && . /usr/share/debconf/confmodule
-
- case "$1" in
- configure)
- # Fix permissions on various log files from old versions of the debian
- # installer, some unrelated to passwd but we decided to put the fix
- # here since there was no better place. This can safely be removed
- # after etch is released.
- # In Ubuntu, it may be wise to keep this code around for longer, since
- # this bug left passwords exposed in Ubuntu 5.10:
- # https://launchpad.net/bugs/34606
- if dpkg --compare-versions "$2" lt "1:4.0.14-9"; then
- if egrep -qs 'passwd/(root|user)-password' /var/log/installer/cdebconf/*
- then
- perl -000 -pi -e '
- if (m{^Name: passwd/(?:root|user)-password(?:-again)? *$}m) {
- s/^Value:.*\n//m
- }' /var/log/installer/cdebconf/* || true
- fi
- for log in /var/log/base-config* \
- $(find /var/log/debian-installer/ /var/log/installer/ -type f 2>/dev/null ); do
- if [ -e "$log" ]; then
- chmod 600 "$log"
- fi
- done
- fi
-
- rm -f /etc/pam.d/passwd.pre-upgrade 2>/dev/null
- if ! getent group shadow | grep -q '^shadow:[^:]*:42'
- then
- groupadd -g 42 shadow || (
- cat <<EOF
- Group ID 42 has been allocated for the shadow group. You have either
- used 42 yourself or created a shadow group with a different ID.
- Please correct this problem and reconfigure with ``dpkg --configure passwd''.
-
- Note that both user and group IDs in the range 0-99 are globally
- allocated by the Debian project and must be the same on every Debian
- system.
- EOF
- exit 1
- )
- fi
-
- # Tidy up after installer security bug that left an empty root
- # password if you backed up from the installer's final message:
- # https://launchpad.net/bugs/48350
- if (dpkg --compare-versions "$2" lt-nl 1:4.0.13-7ubuntu3.2 || \
- [ "$2" = 1:4.0.16-2ubuntu1 ]) && \
- perl -e '(my @root = getpwnam "root") or exit 1;
- my $rootpw = $root[1];
- $rootpw =~ /^(\$1\$[^\$]*\$?)/ or exit 1;
- my $salt = $1;
- exit 1 if $salt eq "";
- my $emptypw = crypt("", $salt);
- exit (($rootpw eq $emptypw) ? 0 : 1);'
- then
- echo "Locking root password left blank by installer bug ..."
- echo 'root:*' | chpasswd -e -m
- fi
- ;;
- esac
-
- # Run shadowconfig only on new installs
- [ -z "$2" ] && shadowconfig on
-
-
-
- exit 0
-